import { noop } from '@/utils/fn';
import { Text, View } from '@tarojs/components';
import React from 'react';
import styles from './index.module.scss';

const SearchRedirect = ({
  className = '',
  placeholder = '',
  showBtn = true,
  btnTxt = '搜索',
  onClick = noop,
}) => {
  return (
    <View className={`${styles.SearchRedirect} ${className}`} onClick={onClick}>
      <View className="redirect-left">
        <Text className="search-icon at-icon at-icon-search"></Text>

        <View className="input omit">{placeholder}</View>
      </View>

      {showBtn && (
        <View className="right">
          <View className="txt">{btnTxt}</View>
        </View>
      )}
    </View>
  );
};

export default SearchRedirect;
